<template>
	<view class="content">
		<image src="../../../static/yaoqing_bejing.png" mode=""></image>
		<view style="width: 450rpx;height: 50rpx;position: absolute;top: 20rpx;margin-left: 30rpx;display: flex;justify-content: space-between;">
			<!-- <image @click="fh" style="width: 20rpx;height: 38rpx;margin-top: 8rpx;" src="../../../static/fanhui.png"></image> -->
			<p style="color: #FFFFFF;font-size: 36rpx;"></p>
		</view>
		<view style="position:absolute;top:140rpx;z-index: 2;">
			<image style="width: 560rpx;height: 90rpx;margin-left: 90rpx;" src="../../../static/yaoqing_zuce.png"></image>
		</view>
		<image src="../../../static/zuce.png" style="width:750rpx;height:418rpx;position:absolute;left: 0;top: 220rpx;z-index: 3;" mode=""></image>
		<view style="position:absolute;top:380rpx;left:60rpx;width:620rpx;height:880rpx;background-color:#FFFFFF;border-radius: 10rpx;">
			<view style="width:550rpx;margin-left:35rpx;border-radius: 10rpx; height:80rpx;background-color: #F5F5F5;margin-top: 300rpx;">
				<input
					type="text"
					placeholder="请输入手机号码"
					v-model="honep"
					style="font-size:24rpx;padding-top: 20rpx;margin-left: 30rpx;background-color: #F5F5F5;border: none;outline: none;"
				/>
			</view>
			<view
				style="width:550rpx;margin-left:35rpx;border-radius: 10rpx; height:80rpx;background-color: #F5F5F5;margin-top: 30rpx;display: flex;justify-content: space-between;"
			>
				<input
					type="text"
					placeholder="请输入验证码"
					v-model="yzm"
					style="font-size:24rpx;padding-top: 20rpx;margin-left: 30rpx;background-color: #F5F5F5;border: none;outline: none;"
				/>
				<p style="color: #ff0000;width: 150rpx;margin-top: 20rpx;" v-show="yz" @click="huoqu">获取验证码</p>
				<view class="Hong_b" v-if="!yz">
					<u-count-down
						:timestamp="timestamp"
						:show-days="false"
						:show-hours="false"
						:show-minutes="false"
						bg-color="#EEF2F5"
						@end="jieshu"
					></u-count-down>
				</view>
			</view>
			<view style="width:550rpx;margin-left:35rpx;border-radius: 10rpx; height:80rpx;background-color: #F5F5F5;margin-top: 30rpx;">
				<input
					type="text"
					placeholder="请输入密码"
					v-model="mm"
					style="font-size:24rpx;padding-top: 20rpx;margin-left: 30rpx;background-color: #F5F5F5;border: none;outline: none;"
				/>
			</view>
			<view style="width:550rpx;margin-left:35rpx;border-radius: 10rpx; height:80rpx;background-color: #F5F5F5;margin-top: 30rpx; display: felx; align-items: center;">
				<text style="line-height: 80rpx; margin-left:20rpx ;">{{yaoqing_ma}}</text>
				<!-- <input
					type="text"
					placeholder="请输入邀请码"
					v-model="yaoqing_ma"
					style="font-size:24rpx;padding-top: 20rpx;margin-left: 30rpx;background-color: #F5F5F5;border: none;outline: none;"
				/> -->
			</view>
			<view
				style="width:550rpx;height: 80rpx;background-color: #FE3548;color: #FFFFFF;font-weight: bold;line-height: 80rpx;text-align: center;margin-top: 30rpx;margin-left: 30rpx;border-radius: 10rpx;"
				@click="zc"
			>
				注 册
			</view>
			<p style="width: 100%;height: 50rpx;text-align: center;line-height: 65rpx;color: #007AFF;" @click="qu_denglu">已有账号,去登录</p>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			yz: true,
			timestamp: 59,

			honep: '',
			yzm: '',
			mm: '',
			yaoqing_ma: '',
			bili: '',
			id: '',
			
		};
	},
	onLoad(e) {
		e && (this.bili = e.bili);
		e && (this.id = e.id);
		e && (this.yaoqing_ma = e.iCd);
	},
	methods: {
		async yanzhengma() {
			let obj = {
				mobile: this.honep,
			};
			const res = await this.$u.post('api/index/sendSms', obj, {});
			
			uni.$showMsg(res.msg);
			if (res.code == 0) {


				this.yz = false;

			}
		},
		async zhu_ce() {
			let obj = {
				mobile: this.honep,
				password: this.mm,
				code: this.yzm,
				push: this.yaoqing_ma,
				uid: this.id,
				scale: this.bili
			};
			const res = await this.$u.post('api/index/register', obj, {});
			console.log(res.msg, 8888888888888);
			uni.$showMsg(res.msg);
			if (res.code == 1) {
				wx.navigateTo({
					url: '../dengli/deng',
				});
			}
		},
		qu_denglu() {
			wx.navigateTo({
				url: '../dengli/deng',
			});
		},
		huoqu() {
			if (this.honep == '') {
				uni.$showMsg('请先填写正确的手机号');
			} else {
				this.yz = !this.yz;
				// debugger;
				this.yanzhengma();
			}
		},
		zc() {
			if (this.honep == '') {
				uni.$showMsg('请先填写正确的手机号');
			} else if (this.yzm == '') {
				uni.$showMsg('请正确填写验证码');
			} else if (this.mm == '') {
				uni.$showMsg('请正确填写密码');
			} else if (this.yaoqing_ma == '') {
				uni.$showMsg('请正确填写邀请码');
			} else {
				this.zhu_ce();
			}

		}
	},
};
</script>

<style lang="scss" scoped>
.content {
	width: 100%;
	height: 100vh;
	position: relative;
	image {
		width: 100%;
		height: 100%;
	}
}
.Hong_b {
	width: 150rpx;
	height: 100rpx;
	line-height: 100rpx;
	color: #999999;
	font-size: 24rpx;
	text-align: right;
	margin-right: 20rpx;
	color: #fe3548;
}
</style>
